package com.todod.base.module.base.dal.mysql.wits8;

import java.util.*;

import com.todod.base.framework.common.pojo.PageResult;
import com.todod.base.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.todod.base.framework.mybatis.core.mapper.BaseMapperX;
import com.todod.base.module.base.controller.admin.rtmaintain.rtmaintainchild.vo.RtMaintainChildPageReqVO;
import com.todod.base.module.base.dal.dataobject.rtmaintain.rtmaintainchild.RtMaintainChildDO;
import com.todod.base.module.base.dal.dataobject.wits8.WITS8DO;
import org.apache.ibatis.annotations.Mapper;
import com.todod.base.module.base.controller.admin.wits8.vo.*;

/**
 * WITS8生成的表 Mapper
 *
 * @author 超管儿
 */
@Mapper
public interface WITS8Mapper extends BaseMapperX<WITS8DO> {

/**
 * 按照要求取一条最新数据
 */
default WITS8DO getNewOne(WITS8PageReqVO reqVO){
    return selectOne(new LambdaQueryWrapperX<WITS8DO>()
            .betweenIfPresent(WITS8DO::getMeasDepth , reqVO.getMeasDepth())
            .orderByDesc(WITS8DO::getCreateTime)
            .last("limit 1")
    );

}
/**
 * 按照要求查询列表
 */
default List<WITS8DO> getNewList(WITS8PageReqVO reqVO) {
    return selectList(new LambdaQueryWrapperX<WITS8DO>()
            .betweenIfPresent(WITS8DO::getMeasDepth, reqVO.getMeasDepth())
            .orderByAsc(WITS8DO::getCreateTime));
}


    default PageResult<WITS8DO> selectPage(WITS8PageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WITS8DO>()
                .orderByDesc(WITS8DO::getId));
    }
}